package com.cntcdt.api.db.dao;

import java.util.List;

import com.cntcdt.api.db.dao.base.DeviceChargeHistoryDaoBase;
import com.cntcdt.api.db.model.DeviceChargeHistoryModel;

/**
 * 这是cdt_device_charge_history的Dao实现类
 */
public class DeviceChargeHistoryDao extends DeviceChargeHistoryDaoBase {
	/**
	 * DeviceChargeHistoryDao对象
	 */
	private static DeviceChargeHistoryDao instance = new DeviceChargeHistoryDao();

	/**
	 * 默认构造方法
	 */
	private DeviceChargeHistoryDao() {
	}

	/**
	 * 获得对象实例
	 */
	public static DeviceChargeHistoryDao getInstance() {
		return instance;
	}

	/**
	 * 通过商家id查询分成规则
	 * 
	 * @param groupUserId
	 * @return
	 */
	public List<DeviceChargeHistoryModel> findByGroupUserId(int groupUserId, int sortTime) {
		sortTime = sortTime * 20;
		String sql = "select * from " + TABLE + " WHERE groupUserId = ? order by addTime desc limit ?,20";
		Object[] paramObjs = { groupUserId, sortTime };
		List<DeviceChargeHistoryModel> modelList = this.queryModelList(sql, paramObjs);

		return modelList;
	}
}
